import request from "../utils/request";

const api_name = '/order'

export default {
    // 获取当前课程购买状态
    isBought(courseId) {
        return request({
            url: `${api_name}/isbought/${courseId}`,
            method: 'get'
        })
    },
    // 获取指定课程的订单id
    showInfo(courseId) {
        return request({
            url: `${api_name}/info/${courseId}`,
            method: 'get'
        })
    },
    // 创建课程订单
    createOrder(courseId) {
        return request({
            url: `${api_name}/${courseId}`,
            method: 'post'
        })
    },
    // 获取用户的所有订单
    getOrders() {
        return request({
            url: `${api_name}/list`,
            method: 'get'
        })
    }
}